<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.3.1.min.js"></script>
    <script>
        function sendAjax(){
            $.ajax({
                type: 'get',
                url: 'http://localhost:8888/myweb/welcome',
                data: {
                    username: '张三'
                },
                dataType: 'json',
                success: function(res){
                    console.log(res)
                    if (res.status === 1){
                        console.log(res.data.name)
                    }else{
                        console.log(res.msg)
                    }
                },
                error: function(err){
                    console.log(err)
                }
            })
        }
    </script>
</head>
<body>
    <button onclick="sendAjax()">发送ajax请求</button>
</body>
</html>